package com.itheima.server.controller;

import com.itheima.server.service.BaiduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/baidu")
public class BaiduController {
    @Autowired
    private BaiduService baiduService;

    /*上传/更新地理位置*/
    @PostMapping("/location")
    public ResponseEntity location(@RequestBody Map<String,String> map){
        //假地址
        Double longitude = 116.40373;
        Double latitude = 39.915046;
        String address =  "北京天安门";
        /*Double longitude = Double.valueOf(map.get("longitude"));
        Double latitude = Double.valueOf(map.get("latitude"));
        String address =  map.get("address");*/
        baiduService.updateLocation(longitude,latitude,address);
        return ResponseEntity.ok(null);

    }

}
